Convert specs to RSpec 3.0.4 syntax with Transpec

This conversion is done by Transpec 2.3.6 with the following command:
    transpec features

* 19 conversions
    from: obj.should
      to: expect(obj).to

* 1 conversion
    from: == expected
      to: eq(expected)

For more details: https://github.com/yujinakayama/transpec#supported-conversions
This commit is contained in:
khall 2014-08-25 15:27:48 -07:00
parent de3e0bd91a
commit 875895f2d0
5 changed files with 19 additions and 19 deletions

View file

@ -6,12 +6,12 @@ module AspectCukeHelpers
def toggle_aspect(a_name)
a_id = @me.aspects.where(name: a_name).pluck(:id).first
aspect_css = ".dropdown li[data-aspect_id='#{a_id}']"
page.should have_selector(aspect_css)
expect(page).to have_selector(aspect_css)
find(aspect_css).click
end
def aspect_dropdown_visible?
find('.aspect_membership.dropdown.active').should be_visible
expect(find('.aspect_membership.dropdown.active')).to be_visible
end
end
World(AspectCukeHelpers)

View file

@ -12,7 +12,7 @@ module ApplicationCukeHelpers
end
def flash_message_containing?(text)
flash_message(text: text).should be_visible
expect(flash_message(text: text)).to be_visible
end
def flash_message(opts={})
@ -23,7 +23,7 @@ module ApplicationCukeHelpers
def confirm_form_validation_error(element)
is_invalid = page.evaluate_script("$('#{element}').is(':invalid')")
is_invalid.should be true
expect(is_invalid).to be true
end
def check_fields_validation_error(field_list)

View file

@ -71,7 +71,7 @@ module NavigationHelpers
def confirm_on_page(page_name)
current_path = URI.parse(current_url).path
current_path.should == path_to(page_name)
expect(current_path).to eq(path_to(page_name))
end
end

View file

@ -8,7 +8,7 @@ module PublishingCukeHelpers
elem.native.send_keys(' ' + txt)
# make sure the other text field got the new contents
find('#status_message_text', visible: false).value.should include(txt)
expect(find('#status_message_text', visible: false).value).to include(txt)
end
def make_post(text)
@ -19,7 +19,7 @@ module PublishingCukeHelpers
def submit_publisher
txt = find('#publisher #status_message_fake_text').value
find('#publisher .creation').click
page.should have_content(txt) unless page.has_css?('.nsfw-shield')
expect(page).to have_content(txt) unless page.has_css?('.nsfw-shield')
end
def click_and_post(text)
@ -42,19 +42,19 @@ module PublishingCukeHelpers
def expand_first_post
within(".stream_element", match: :first) do
find(".expander").click
has_css?(".expander").should be false
expect(has_css?(".expander")).to be false
end
end
def first_post_collapsed?
find(".stream_element .collapsible", match: :first).should have_css(".expander")
page.should have_css(".stream_element .collapsible.collapsed", match: :first)
expect(find(".stream_element .collapsible", match: :first)).to have_css(".expander")
expect(page).to have_css(".stream_element .collapsible.collapsed", match: :first)
end
def first_post_expanded?
page.should have_no_css(".stream_element .expander", match: :first)
page.should have_no_css(".stream_element .collapsible.collapsed", match: :first)
page.should have_css(".stream_element .collapsible.opened", match: :first)
expect(page).to have_no_css(".stream_element .expander", match: :first)
expect(page).to have_no_css(".stream_element .collapsible.collapsed", match: :first)
expect(page).to have_css(".stream_element .collapsible.opened", match: :first)
end
def first_post_text
@ -74,7 +74,7 @@ module PublishingCukeHelpers
end
def find_post_by_text(text)
page.should have_text(text)
expect(page).to have_text(text)
find(".stream_element", text: text)
end
@ -119,7 +119,7 @@ module PublishingCukeHelpers
def assert_nsfw(text)
post = find_post_by_text(text)
post.find(".nsfw-shield").should be_present
expect(post.find(".nsfw-shield")).to be_present
end
end

View file

@ -105,12 +105,12 @@ module UserCukeHelpers
end
def confirm_getting_started_contents
page.should have_content("Well, hello there!")
page.should have_content("Who are you?")
page.should have_content("What are you into?")
expect(page).to have_content("Well, hello there!")
expect(page).to have_content("Who are you?")
expect(page).to have_content("What are you into?")
# the username that was just entered for registration
page.should have_field("profile_first_name", with: @username)
expect(page).to have_field("profile_first_name", with: @username)
end
end