librelist archives

« back to archive

Greeting example - undefined method `should'

Greeting example - undefined method `should'

From:
Daniel Harfleet
Date:
2011-10-18 @ 10:42
Hi,

I am trying out the example shown in Ben's video here: http://vimeo.com/20302989

My results are as follows:

Feature: Greeting

  Scenario: Greet the User                                     # 
features/greeting.feature:2
    When I type "John" in the "Name" text field                # 
melomel-0.6.5/lib/melomel/cucumber/text_steps.rb:1
    And I click the "Greet" button                             # 
melomel-0.6.5/lib/melomel/cucumber/button_steps.rb:1
    Then I should see an alert with the message: "Hello John!" # 
melomel-0.6.5/lib/melomel/cucumber/alert_steps.rb:26
      undefined method `should' for "Hello John!":String (NoMethodError)
      features/greeting.feature:5:in `Then I should see an alert with the 
message: "Hello John!"'

Failing Scenarios:
cucumber features/greeting.feature:2 # Scenario: Greet the User

1 scenario (1 failed)
3 steps (1 failed, 2 passed)




features/greeting.feature
-------------------------

Feature: Greeting
    Scenario: Greet the User
        When I type "John" in the "Name" text field
        And I click the "Greet" button
        Then I should see an alert with the message: "Hello John!"



LearnMelomel.mxml
-----------------

<?xml version="1.0" encoding="utf-8"?>
<mx:Application 
    layout="vertical" minWidth="955" minHeight="600"
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:melomel="library://melomel/2010">


    <mx:VBox>
        <mx:Label text="Name"/>
        <mx:TextInput id="nameInput"/>
    </mx:VBox>

    <mx:Button 
        label="Greet"
        click="displayGreeting(nameInput.text)"/>


    <melomel:Melomel/>
    <mx:Script>
        <![CDATA[
            private function displayGreeting(name:String):void
            {
                var message:String = "Hello " + name + "!";
                mx.controls.Alert.show(message);
            }
        ]]>
    </mx:Script>

</mx:Application>


features/support/env.rb
-----------------------

require 'rubygems'
require 'melomel/cucumber'
require 'selenium-webdriver'



Before do |scenario|
  @driver = Selenium::WebDriver.for :firefox
  @driver.navigate.to 
"file:///Users/dharfleet/LearnMelomel/bin-debug/LearnMelomel.swf"
  Melomel.connect()
end

After do |scenario|
  @driver.quit() unless @driver.nil?
end

-------------------------

I have not used Ruby or Gems before, so am a novice in that area. Any 
pointers gratefully received,


dan

Re: [melomel] Greeting example - undefined method `should'

From:
Georg Meyer
Date:
2011-10-28 @ 08:19
Hi,

sorry for the late reply, hope you're still using melomel :)

This seems to be an rspec issue. Do you have 'gem rspec' in your
Gemfile?

See http://rspec.info/ for more informarion.

Am Dienstag, den 18.10.2011, 03:42 -0700 schrieb Daniel Harfleet:
> Hi,
> 
> 
> I am trying out the example shown in Ben's video here:
> http://vimeo.com/20302989
> 
> 
> My results are as follows:
> 
> 
> Feature: Greeting
> 
>   Scenario: Greet the User                                     #
> features/greeting.feature:2
>     When I type "John" in the "Name" text field                #
> melomel-0.6.5/lib/melomel/cucumber/text_steps.rb:1
>     And I click the "Greet" button                             #
> melomel-0.6.5/lib/melomel/cucumber/button_steps.rb:1
>     Then I should see an alert with the message: "Hello John!" #
> melomel-0.6.5/lib/melomel/cucumber/alert_steps.rb:26
>       undefined method `should' for "Hello John!":String
> (NoMethodError)
>       features/greeting.feature:5:in `Then I should see an alert with
> the message: "Hello John!"'
> 
> Failing Scenarios:
> cucumber features/greeting.feature:2 # Scenario: Greet the User
> 
> 1 scenario (1 failed)
> 3 steps (1 failed, 2 passed)
> 
> 
> 
> 
> 
> 
> 
> features/greeting.feature
> -------------------------
> 
> 
> Feature: Greeting
>     Scenario: Greet the User
>         When I type "John" in the "Name" text field
>         And I click the "Greet" button
>         Then I should see an alert with the message: "Hello John!"
> 
> 
> 
> 
> 
> LearnMelomel.mxml
> -----------------
> 
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application 
>     layout="vertical" minWidth="955" minHeight="600"
>     xmlns:mx="http://www.adobe.com/2006/mxml"
>     xmlns:melomel="library://melomel/2010">
> 
> 
>     <mx:VBox>
>         <mx:Label text="Name"/>
>         <mx:TextInput id="nameInput"/>
>     </mx:VBox>
> 
>     <mx:Button 
>         label="Greet"
>         click="displayGreeting(nameInput.text)"/>
> 
> 
>     <melomel:Melomel/>
>     <mx:Script>
>         <![CDATA[
>             private function displayGreeting(name:String):void
>             {
>                 var message:String = "Hello " + name + "!";
>                 mx.controls.Alert.show(message);
>             }
>         ]]>
>     </mx:Script>
> 
> </mx:Application>
> 
> 
> 
> features/support/env.rb
> -----------------------
> 
> 
> require 'rubygems'
> require 'melomel/cucumber'
> require 'selenium-webdriver'
> 
> 
> 
> Before do |scenario|
>   @driver = Selenium::WebDriver.for :firefox
>   @driver.navigate.to
> "file:///Users/dharfleet/LearnMelomel/bin-debug/LearnMelomel.swf"
>   Melomel.connect()
> end
> 
> After do |scenario|
>   @driver.quit() unless @driver.nil?
> end
> 
> 
> -------------------------
> 
> 
> I have not used Ruby or Gems before, so am a novice in that area. Any
> pointers gratefully received,
> 
> 
> 
> 
> dan
> 
> 
> 
> 
> 
> 
> 
> 
>